package com.cloudkinto.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 *
 * </p>
 *
 * @author hua
 * @since 2024-10-28
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_product_stock")
@NoArgsConstructor
public class ProductStockDo extends Model<ProductStockDo> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @TableField(value = "company_id", fill = FieldFill.INSERT)
    private Long companyId;

    @TableField(value = "wh_id", fill = FieldFill.INSERT)
    private Long whId;

    /**
     * 订单类型
     */
    @TableField("order_type")
    private String orderType;

    /**
     * 单据id、上架id
     */
    @TableField("order_id")
    private Long orderId;

    /**
     * 产品id 常规入库--按产品入库...
     */
    @TableField("product_id")
    private Long productId;

    /**
     * 箱类号 中转入库
     */
    @TableField("box_type_number")
    private String boxTypeNumber;

    /**
     * 箱唛号 常规入库--按箱入库
     */
    @TableField("box_mark_number")
    private String boxMarkNumber;

    /**
     * 接收数量
     */
    @TableField("receive_quantity")
    private Integer receiveQuantity;

    /**
     * 0退货库存 1产品库存 2箱库存(按箱类号)  3箱库存(按箱唛号)
     */
    @TableField("type")
    private Integer type;

    @TableField(value = "tenant_id", fill = FieldFill.INSERT)
    private Long tenantId;

    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;

    @TableField(value = "create_by", fill = FieldFill.INSERT)
    private Long createBy;

    @TableField(value = "create_by_name", fill = FieldFill.INSERT)
    private String createByName;

    @TableField("delete_flag")
    @TableLogic
    private Integer deleteFlag;


    public ProductStockDo(Long companyId, Long whId, String orderType, Long orderId, Long productId, Integer receiveQuantity, Integer type, Long tenantId) {
        this.companyId = companyId;
        this.whId = whId;
        this.orderType = orderType;
        this.orderId = orderId;
        this.productId = productId;
        this.receiveQuantity = receiveQuantity;
        this.type = type;
        this.tenantId = tenantId;
    }

    public ProductStockDo(Long companyId, Long whId, String orderType, Long orderId, String boxTypeNumber, Integer receiveQuantity, Integer type, Long tenantId) {
        this.companyId = companyId;
        this.whId = whId;
        this.orderType = orderType;
        this.orderId = orderId;
        this.boxTypeNumber = boxTypeNumber;
        this.receiveQuantity = receiveQuantity;
        this.type = type;
        this.tenantId = tenantId;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
